﻿function showwait(time) {
    //一下部分是等待图片的信息
    var waitimg = document.createElement("div"); //首先创建一个div
    waitimg.setAttribute("id", "mywait"); //定义该div的id
    waitimg.style.cssText = "position:absolute; z-index:520; left:50%; top:40%; text-align:center; width:16px; height:16px; background:url('../../../Images/ajax-loader.gif') no-repeat;";
    //以下部分要将弹出层居中显示
//    var t = document.documentElement.scrollTop || document.body.scrollTop;
//    var clie = document.documentElement.clientHeight || document.body.clientHeight;
//    waitimg.style.left = (document.documentElement.clientWidth - waitimg.clientWidth) / 2 + document.documentElement.scrollLeft;
//    //    var top = 126 + (clie / 2) + t;
//    var top = (clie / 2) + t - 126;
//    waitimg.style.top = top;
    document.body.appendChild(waitimg);

    //以下部分使整个页面至灰不可点击
    var procbg = document.createElement("div"); //首先创建一个div
    procbg.setAttribute("id", "mybg"); //定义该div的id
    procbg.style.background = "#000000";
    procbg.style.width = "100%";
    procbg.style.height = "100%";
    procbg.style.position = "fixed";
    procbg.style.top = "0";
    procbg.style.left = "0";
    procbg.style.zIndex = "500";
    procbg.style.opacity = "0.6";
    procbg.style.filter = "Alpha(opacity=30)";
    //以上部分也可以用csstext代替
    // procbg.style.cssText="background:#000000;width:100%;height:100%;position:fixed;top:0;left:0;zIndex:500;opacity:0.6;filter:Alpha(opacity=70);";
    //背景层加入页面
    document.body.appendChild(procbg);
    setTimeout("closewait()", time*1000);
}
function closewait() //关闭弹出层
{
    var body = document.getElementsByTagName("body");
    var mybg = document.getElementById("mybg");
    var waitimg = document.getElementById("mywait");
    if (mybg!=null) body[0].removeChild(mybg);
    if (waitimg != null) body[0].removeChild(waitimg);
}